package CreatePhase;


import Entities.Scene;
import Phase.JDoubleBufferedPanel;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class CreatePhasePanel extends JPanel{
    private JDoubleBufferedPanel canvas;
    private JPanel brickPanel;
    private JButton brickButton;
    private JLabel resistanceLabel;
    private JTextField resistanceText;
    private JButton finishButton;
    private JButton exitButton;
    
    
    public CreatePhasePanel(){
        canvas = new JDoubleBufferedPanel();
        brickPanel = new JPanel();
        brickButton = new JButton(new ImageIcon("brick.png"));
        resistanceLabel = new JLabel("Resistencia: ");
        resistanceText = new JTextField("0");
        finishButton = new JButton("Finish"); 
        exitButton = new JButton("Exit");
        initComponents();
    }

    public JButton getBrickButton() {
        return brickButton;
    }

    public JButton getFinishButton() {
        return finishButton;
    }

    public JDoubleBufferedPanel getCanvas() {
        return canvas;
    }

    private void initComponents() {
        
        canvas.setSize(new Dimension(400, 300));
        canvas.setPreferredSize(new Dimension(400, 300));
        canvas.setMaximumSize(new Dimension(400, 300));
        canvas.setMinimumSize(new Dimension(400, 300));
        canvas.setBackground(Color.red);
        canvas.setVisible(true);
        this.add(canvas,new BorderLayout().CENTER);        
        this.add(brickPanel, new BorderLayout().SOUTH);
        
        brickButton.setSize(new Dimension(30, 30));
        brickButton.setPreferredSize(new Dimension(30, 30));
        brickButton.setMaximumSize(new Dimension(30, 30));
        brickButton.setMinimumSize(new Dimension(30, 30));
        
        resistanceText.setSize(new Dimension(50, 30));
        resistanceText.setPreferredSize(new Dimension(50, 30));
        resistanceText.setMaximumSize(new Dimension(50, 30));
        resistanceText.setMinimumSize(new Dimension(50, 30));
        
        finishButton.setSize(new Dimension(150,30));
        finishButton.setPreferredSize(new Dimension(150,30));
        finishButton.setMaximumSize(new Dimension(150,30));
        finishButton.setMinimumSize(new Dimension(150,30));
        
        exitButton.setSize(new Dimension(150,30));
        exitButton.setPreferredSize(new Dimension(150,30));
        exitButton.setMaximumSize(new Dimension(150,30));
        exitButton.setMinimumSize(new Dimension(150,30));
        
        brickPanel.add(brickButton, new BorderLayout().WEST);
        brickPanel.add(resistanceLabel, new BorderLayout().EAST);
        brickPanel.add(resistanceText, new BorderLayout().EAST);
        brickPanel.add(finishButton, new BorderLayout().EAST);
        brickPanel.add(exitButton, new BorderLayout().SOUTH);
        this.setVisible(true);
    }

    public JTextField getResistanceText() {
        return resistanceText;
    }

    public JButton getExitButton() {
        return exitButton;
    }
    
}
